<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles"
	prefix="tiles"%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/css/style.css">
<script language="JavaScript"
	src="<%=request.getContextPath()%>/js/util.js"></script>
<title><tiles:insert flush="false" attribute="title" /></title>
</head>
<body>
<f:view>
	<f:loadBundle basename="resource.bundle.messages" var="messages" />
	<h:form>
		<rich:panel header="#{messages['partner.registration']}">
			<h:panelGrid>
				<h:outputText value="#{errorBean.errorMessage}" styleClass="error"></h:outputText>
			</h:panelGrid>

			<h:panelGrid width="100%">
				<h:outputText value="#{messages['partner.info']}" styleClass="sub_header" />
				<h:panelGroup>
					<h:outputText value="*" styleClass="standardText_Mandatory" />
					<h:outputText value="#{messages['instruction']}" styleClass="standardText_Instruction" />
				</h:panelGroup>
			</h:panelGrid>

			<t:panelGrid columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">

				<h:outputText></h:outputText>
				<t:message for="name" styleClass="error"></t:message>

				<h:panelGroup>
					<h:outputText value="*" styleClass="standardText_Mandatory" />
					<h:outputLabel for="name" value="#{messages['contact.person']}" styleClass="standardText_Label" />
				</h:panelGroup>
				<h:panelGroup>
					<t:inputText id="name" required="true" size="50" maxlength="50" styleClass="standardText" value="#{partnerRegBean.partner.contactPerson}"></t:inputText>
				</h:panelGroup>
				
				<h:outputText></h:outputText>
				<t:message for="department" styleClass="error"></t:message>

				<h:panelGroup>
					<h:outputText value="*" styleClass="standardText_Mandatory" />
					<h:outputLabel for="department" value="#{messages['department']}" styleClass="standardText_Label" />
				</h:panelGroup>
				<h:panelGroup>
					<t:inputText id="department" required="true" size="50" maxlength="50" styleClass="standardText" value="#{partnerRegBean.partner.deparment}"></t:inputText>
				</h:panelGroup>
				
				<h:outputText></h:outputText>
				<t:message for="telephone" styleClass="error"></t:message>
			    
			    <h:outputLabel for="telephone" value="#{messages['telephone.no']}" styleClass="standardText_Label" />
		    	<t:inputText id="telephone" required="false" size="50" maxlength="50" styleClass="standardText" value="#{partnerRegBean.partner.telno}">
		    		<t:validateRegExpr pattern="\d{2}-\d{8}"/>
		    	</t:inputText>
			    
			    <h:outputText></h:outputText>
				<t:message for="fax" styleClass="error"></t:message>	
			    
			    <h:outputLabel for="fax" value="#{messages['fax.no']}" styleClass="standardText_Label" />
		    	<t:inputText id="fax" required="false" size="50" maxlength="50" styleClass="standardText" value="#{partnerRegBean.partner.faxno}">
		    		<t:validateRegExpr pattern="\d{2}-\d{8}"/>
		    	</t:inputText>
				
				<h:outputText></h:outputText>
				<t:message for="email" styleClass="error"></t:message>
				
			   <h:panelGroup>
				   	<h:outputText value="*" styleClass="standardText_Mandatory" />	
				    <h:outputLabel for="email" value="#{messages['email']}" styleClass="standardText_Label" />
			   </h:panelGroup>
			   <h:panelGroup>
			   	<t:inputText id="email" required="true" size="50" maxlength="50" styleClass="standardText" value="#{partnerRegBean.partner.email}">
			   		<t:validateEmail></t:validateEmail>
			   	</t:inputText>
			   </h:panelGroup>

			</t:panelGrid>
			
			<h:panelGrid width="100%">
				<h:outputText value="#{messages['company.info']}"
					styleClass="sub_header" />
			</h:panelGrid>
			
			<t:panelGrid id="compInfo" columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">
				<h:outputText></h:outputText>
				<t:message for="CompanyName" styleClass="error"></t:message>
				
				<h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory"/>
					<h:outputLabel for="CompanyName" value="#{messages['name']}" styleClass="standardText_Label" />
				</h:panelGroup>
				<t:inputText id="CompanyName" size="50" maxlength="50" required="true" styleClass="standardText" value="#{partnerRegBean.partner.compName}"></t:inputText>
				
				<h:outputText></h:outputText>
				<t:message for="RegNo" styleClass="error"></t:message>
				
				<h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory"/>
					<h:outputLabel for="RegNo" value="#{messages['registration.no']}" styleClass="standardText_Label" />
				</h:panelGroup>
				<t:inputText id="RegNo" size="50" required="true" maxlength="50" styleClass="standardText" value="#{partnerRegBean.partner.regNo}"></t:inputText>
	    
				<h:outputText></h:outputText>
				<t:message for="CompanyAdress1" styleClass="error"></t:message>
				
				<h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory"/>
			    	<h:outputLabel for="CompanyAdress1" value="#{messages['address']}" styleClass="standardText_Label" />
				</h:panelGroup>
				<t:inputText id="CompanyAdress1" required="true" size="50" maxlength="50"  styleClass="standardText" value="#{partnerRegBean.partner.compAddress1}"></t:inputText>
			    
			    <h:outputText></h:outputText>
				<t:message for="CompanyAdress2" styleClass="error"></t:message>
			    
			    <h:panelGroup></h:panelGroup>
			    <h:panelGroup>
			    	<t:inputText id="CompanyAdress2" size="50" maxlength="50" styleClass="standardText" value="#{partnerRegBean.partner.compAddress2}"></t:inputText>
			    </h:panelGroup>
			    
			    <h:outputText></h:outputText>
				<t:message for="CompanyPostcode" styleClass="error"></t:message>
			    
			    <h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory" />
			    	<h:outputLabel for="CompanyPostcode" value="#{messages['postcode']}" styleClass="standardText_Label" />
			    </h:panelGroup>
		    	<t:inputText id="CompanyPostcode" required="true" size="50" maxlength="5" styleClass="standardText" 
		    	value="#{partnerRegBean.partner.compPostcode}">
		    		<t:validateRegExpr pattern="\d{5}|\d{4}"/>
		    	</t:inputText>
		    	
		    	<h:outputText></h:outputText>
				<t:message for="CompanyCity" styleClass="error"></t:message>
			    
			    <h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory"/>		
			    	<h:outputLabel for="CompanyCity" value="#{messages['city']}" styleClass="standardText_Label" />
			    </h:panelGroup>
		        <t:inputText id="CompanyCity" required="true" size="50" maxlength="50" styleClass="standardText" value="#{partnerRegBean.partner.compCity}"></t:inputText>
		    	
			    	
			    <h:outputText></h:outputText>
				<t:message for="CompanyCountry" styleClass="error"></t:message>
			    
			    <h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory"/>
			    <h:outputLabel for="CompanyCountry"  value="#{messages['country']}" styleClass="standardText_Label" />
			    </h:panelGroup>
		    	<t:selectOneMenu id="CompanyCountry" required="true" styleClass="standardText" value="#{partnerRegBean.compCountryId}">
		    		<f:selectItem  itemLabel="#{messages['please.select']}" itemValue=""/>
		    		<f:selectItems value="#{partnerRegBean.countryList}"/>
		    		<a4j:support event="onclick" reRender="CompanyState" ajaxSingle="true"/>
		    	</t:selectOneMenu>
		    	
		    	
		    	<h:outputText></h:outputText>
				<t:message for="CompanyState" styleClass="error"></t:message>
			    
			    <h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory" />
			   		<h:outputLabel for="CompanyState" value="#{messages['state']}" styleClass="standardText_Label" />
			    </h:panelGroup>
		    	<t:selectOneMenu id="CompanyState" required="true" styleClass="standardText" value="#{partnerRegBean.compStateId}">
		    		<f:selectItem  itemLabel="#{messages['please.select']}" itemValue=""/>
		    		<f:selectItems value="#{partnerRegBean.compStateList}"/>
		    	</t:selectOneMenu>
		    	
		    	
			    
			    <h:outputText></h:outputText>
				<t:message for="TelephoneNoOffice" styleClass="error"></t:message>
			    
			    <h:outputLabel for="TelephoneNoOffice" value="#{messages['telephone.no']}" styleClass="standardText_Label" />
		    	<t:inputText id="TelephoneNoOffice" required="false" size="50" maxlength="50" styleClass="standardText" value="#{partnerRegBean.partner.compTelno}">
		    		<t:validateRegExpr pattern="\d{2}-\d{8}"/>
		    	</t:inputText>
			    
			    <h:outputText></h:outputText>
				<t:message for="FaxNoOffice" styleClass="error"></t:message>	
			    
			    <h:outputLabel for="FaxNoOffice" value="#{messages['fax.no']}" styleClass="standardText_Label" />
		    	<t:inputText id="FaxNoOffice" required="false" size="50" maxlength="50" styleClass="standardText" value="#{partnerRegBean.partner.compFaxno}">
		    		<t:validateRegExpr pattern="\d{2}-\d{8}"/>
		    	</t:inputText>
			</t:panelGrid>
			
			<h:panelGrid width="100%">
				<h:outputText value="#{messages['mailing.info']}"
					styleClass="sub_header" />
			</h:panelGrid>
			
			<t:panelGrid id="mailInfo" columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">
			
				<h:outputText></h:outputText>
				<t:message for="MailBy" styleClass="error"></t:message>
				
				<h:panelGroup>
					<h:outputText value="*" styleClass="standardText_Mandatory" />
					<h:outputLabel for="MailBy" value="#{messages['mail.by']}"
						styleClass="standardText_Label" />
				</h:panelGroup>
				<h:panelGroup>
					<t:selectOneRadio id="MailBy" styleClass="standardText" value="#{partnerRegBean.mailBy}">
						<f:selectItems value="#{partnerRegBean.mailSelectList}"/>
						<a4j:support event="onclick" ajaxSingle="true" reRender="mailInfo"></a4j:support>
					</t:selectOneRadio>
				</h:panelGroup>
				
				<h:outputText></h:outputText>
				<t:message for="MailAddress1" styleClass="error"></t:message>
				
				<h:panelGroup>
					<h:outputText value="*" styleClass="standardText_Mandatory" rendered="#{partnerRegBean.checkFlag}"/>
					<h:outputLabel for="MailAddress1" value="#{messages['address']}" styleClass="standardText_Label" />
				</h:panelGroup>
				
			    <t:inputText id="MailAddress1" readonly="#{!partnerRegBean.checkFlag}" size="50" maxlength="50" required="#{partnerRegBean.checkFlag}" styleClass="standardText" value="#{partnerRegBean.partner.mailAddress1}"></t:inputText>
			     
			    <h:outputText></h:outputText>
				<t:message for="MailAddress2" styleClass="error"></t:message>
			     
			    <h:panelGroup></h:panelGroup>
			    <h:panelGroup>
			    	<t:inputText id="MailAddress2" readonly="#{!partnerRegBean.checkFlag}"  size="50" maxlength="50" styleClass="standardText" value="#{partnerRegBean.partner.mailAddress2}"></t:inputText>
			    </h:panelGroup>
			    
			    <h:outputText></h:outputText>
				<t:message for="MailPostcode" styleClass="error"></t:message>
			    
			    <h:panelGroup>
					<h:outputText value="*" styleClass="standardText_Mandatory" rendered="#{partnerRegBean.checkFlag}"/>
					<h:outputLabel for="MailPostcode" value="#{messages['postcode']}" styleClass="standardText_Label" />
				</h:panelGroup>
			    <t:inputText id="MailPostcode" readonly="#{!partnerRegBean.checkFlag}"  size="50" maxlength="5" required="#{partnerRegBean.checkFlag}" styleClass="standardText" value="#{partnerRegBean.partner.mailPostcode}">
			    		<t:validateRegExpr pattern="\d{5}|\d{4}"/>
			    </t:inputText>
			    
			    <h:outputText></h:outputText>
				<t:message for="MailCity" styleClass="error"></t:message>
			    
			    <h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory" rendered="#{partnerRegBean.checkFlag}"/>
					 <h:outputLabel for="MailCity" value="#{messages['city']}" styleClass="standardText_Label" />
				</h:panelGroup>	
				<t:inputText  id="MailCity" readonly="#{!partnerRegBean.checkFlag}" required="#{partnerRegBean.checkFlag}" size="50" maxlength="50" styleClass="standardText" value="#{partnerRegBean.partner.mailCity}"></t:inputText>
			    
			    	
			    <h:outputText></h:outputText>
				<t:message for="MailCountry" styleClass="error"></t:message>
			    
			     <h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory" rendered="#{partnerRegBean.checkFlag}"/>
					 <h:outputLabel for="MailCountry" value="#{messages['country']}" styleClass="standardText_Label" />
				</h:panelGroup>
		    	<t:selectOneMenu  id="MailCountry" readonly="#{!partnerRegBean.checkFlag}" required="#{partnerRegBean.checkFlag}"  styleClass="standardText" value="#{partnerRegBean.mailCountryId}">
		    		<f:selectItem  itemLabel="#{messages['please.select']}" itemValue=""/>
		    		<f:selectItems value="#{partnerRegBean.countryList}"/>
		    		<a4j:support event="onclick" ajaxSingle="true" reRender="MailState"></a4j:support>
		    	</t:selectOneMenu>
		    	
		    	
			    <h:outputText></h:outputText>
				<t:message for="MailState" styleClass="error"></t:message>
			    
			    <h:panelGroup>
					 <h:outputText value="*" styleClass="standardText_Mandatory" rendered="#{partnerRegBean.checkFlag}"/>
					 <h:outputLabel for="MailState" value="#{messages['state']}" styleClass="standardText_Label" />
				</h:panelGroup>
		    	<t:selectOneMenu  id="MailState" readonly="#{!partnerRegBean.checkFlag}" required="#{partnerRegBean.checkFlag}"  styleClass="standardText" value="#{partnerRegBean.mailStateId}">
		    		<f:selectItem  itemLabel="#{messages['please.select']}" itemValue=""/>
		    		<f:selectItems value="#{partnerRegBean.mailStateList}"/>
		    	</t:selectOneMenu>
			    
			   
			</t:panelGrid>
			
			<rich:spacer height="30"></rich:spacer>
			
			<t:panelGrid columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">
				<t:outputText></t:outputText>
				<t:panelGroup>
				
		   			<h:commandButton value="#{messages['register']}" styleClass="button" action="#{partnerRegBean.createPartner}"></h:commandButton>
		   			<f:verbatim>&nbsp;</f:verbatim>
				 	<h:commandButton value="#{messages['back']}" styleClass="button" action="index"  immediate="true"></h:commandButton>
		   		</t:panelGroup>
			</t:panelGrid>
			
		</rich:panel>
	</h:form>
</f:view>
</body>
</html>
